package com.example.bensonzheng.appcompattest;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.SeekBar;

/**
 * 作者： benson.zheng   时间： 15/9/13.
 * 功能：
 * 修改：
 */
public class NextActivity extends BaseAppCompatAcitvity {
    Drawable mStatusDrawable;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activiyt_next);
        View statusView=getCustomStatusView();
        mToolbarDrawable.setAlpha(0);
        if (statusView != null) {
            mStatusDrawable = getResources().getDrawable(R.drawable.colorPrimaryDark);
            mStatusDrawable.setAlpha(0);
            statusView.setBackgroundDrawable(mStatusDrawable);

        }
        SeekBar seekBar = (SeekBar) findViewById(R.id.seekBar);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                Log.d("NextActivity", ((progress / 100f) * 255) + "," + progress);
                int alpha = (int) ((progress / 100f) * 255);
                mToolbarDrawable.setAlpha(alpha);
                if (mStatusDrawable != null) {
                    mStatusDrawable.setAlpha(alpha);
                }
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });

    }

    @Override
    protected int provideFrameLayoutResId() {
        return R.layout.base_frame_status_layout;
    }

    @Override
    public boolean isUseCustomStatusView() {
        return true;
    }
}
